<template>
    <ul>
        <li v-for="item in props.items" :key="item.id">
            <div class="ibox">
                <div class="img_left">
                    <img src="../../assets/image/avator.jpg" alt="">
                    <!-- <img :src="item.avatar" alt="" /> -->
                </div>
                <div class="content_right">
                    <div class="title">{{ item.title }}</div>
                    <div class="info">
                        <p>{{ item.info }}</p>
                    </div>
                    <div class="footer">
                        <el-tag :type="item.tags === 1 ? 'danger' : 'success'">
                            {{ item.tags === 1 ? "原创" : "转载" }}
                        </el-tag>
                        <span>发布时间:{{ item.publishTime }}</span>
                        <span>{{ item.read }}&nbsp;阅读</span>
                        <span>{{ item.like }}&nbsp;点赞</span>
                        <span>{{ item.comment }}&nbsp;评论</span>
                        <span>{{ item.collection }}&nbsp;收藏</span>
                    </div>
                </div>
            </div>
        </li>
    </ul>
</template>

<script setup>
import { ref } from 'vue'
import { defineProps } from 'vue'

const props = defineProps({
    items: {
        type: Array,
        default: () => []
    }
})
</script>
<style lang="scss" scoped>
ul {
    list-style: none;
    margin: 0;
    padding: 0;

    li {
        width: 90%;
        margin: 0 auto;
        height: 150px;
        padding: 10px 0;
        border-bottom: 1px solid darkgray;
        cursor: pointer;

        .ibox {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;

            .img_left {
                width: 180px;
                height: 120px;
                margin: 0 10px 0 20px;

                img {
                    width: 100%;
                    height: 100%;
                }
            }

            .content_right {
                width: calc(100% - 230px);
                height: 120px;
                display: flex;
                flex-direction: column;
                align-items: flex-start;

                .title,
                .info,
                .footer {
                    width: 100%;
                }

                .title {
                    height: 30px;
                    font-size: 22px;
                    font-weight: bold;
                    text-align: left;
                    overflow: hidden;
                }

                .info {
                    height: calc(100% - 65px); //90字后省略
                    overflow: hidden;
                    white-space: normal;

                    p {
                        width: 100%;
                        height: 100%;
                        margin: 10px 0 10px 0;
                        text-indent: 2em;
                    }
                }

                .footer {
                    height: 28px;
                    display: flex;
                    flex-direction: row;
                    align-items: flex-end;

                    span {
                        margin-left: 5px;
                        margin-right: 25px;
                        font-size: 15px;
                    }
                }
            }
        }
    }
}
</style>